Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Github.Repo.RulesetModified rule #1453

Conversation

geoffg-sentry
Copy link
Contributor

Background

The cool kidz these days are using ruleset instead of or in combination with branch protection rules. This rule alerts to modifications (update, destroy) of rulesets and adds an INFO-level signal for ruleset creations if desired for future correlation rules. Filters can be applied in global_filter_github and the github_alert_context is enriched specific to repo ruleset changes.

[1] https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets

Changes

  • Create GitHub.Repo.RulsetModified rule
  • Tests for each create/update/destroy event type
  • Update the github.yml pack

Testing

pat test, make lint

### Background

The cool kidz these days are using ruleset instead of or in combination with branch protection rules. This rule alerts to modifications (update, destroy) of rulesets and adds an INFO-level signal for ruleset creations if desired for future correlation rules. Filters can be applied in global_filter_github and github_alert_context is enriched specific to repo ruleset changes.

[1] https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets

### Changes

- Create GitHub.Repo.RulsetModified rule
- Tests for each create/update/destroy event type
- Update the github.yml pack

### Testing

pat test, make lint
@geoffg-sentry geoffg-sentry requested a review from a team as a code owner December 17, 2024 21:31
Copy link
Contributor

@arielkr256 arielkr256 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@geoffg-sentry very nice! Made a couple of minor adjustments but overall looks great.

rules/github_rules/github_repo_ruleset_modified.py Outdated Show resolved Hide resolved
rules/github_rules/github_repo_ruleset_modified.yml Outdated Show resolved Hide resolved
ctx["operation_type"] = event.get("operation_type", "")
ctx["ruleset_bypass_actors"] = event.deep_walk("ruleset_bypass_actors")
ctx["ruleset_conditions"] = event.deep_walk("ruleset_conditions")
ctx["ruleset_rules"] = event.deep_walk("ruleset_rules")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice alert context!

@arielkr256 arielkr256 enabled auto-merge (squash) January 9, 2025 15:49
@arielkr256 arielkr256 merged commit 38e38ec into panther-labs:develop Jan 9, 2025
8 checks passed
@arielkr256 arielkr256 added the rules Real-time log data detections label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rules Real-time log data detections
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants